package com.zhiyou.wisdom.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zhiyou.wisdom.mapper.VisitorMapper;
import com.zhiyou.wisdom.pojo.Visitor;
import com.zhiyou.wisdom.service.VisitorService;
@Service
public class VisitorServiceImpl implements VisitorService {
	@Autowired
	private VisitorMapper visitorMapper;
	
	@Override
	public Visitor selectByPrimaryKey(Integer vId) {
		// TODO Auto-generated method stub
		return visitorMapper.selectByPrimaryKey(vId);
	}

	@Override
	public int insert(Visitor record) {
		// TODO Auto-generated method stub
		return visitorMapper.insert(record);
	}

	@Override
	public Map<String, Object> selectByParams(int flag) {
		// TODO Auto-generated method stub
		Map<String, Object>  map=new HashMap<>();
		List<Visitor> list = visitorMapper.selectByParams(flag);
		map.put("count", list.size());
		map.put("visitors", list);
		return map;
	}

	@Override
	public Map<String, Object> selectByAudit(int flag) {
		// TODO Auto-generated method stub
		Map<String, Object>  map=new HashMap<>();
		List<Visitor> list=visitorMapper.selectByAudit(flag);
		map.put("audit_count", list.size());
		map.put("visitors", list);
		return map;
	}

	
	
}
